﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class BG_Manage_BG_UserAdd : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnAdd_ServerClick(object sender, EventArgs e)
    {

        string UserName = this.inp_uname.Value;
        string Password = this.passwordconfirm.Value;

        string Question;
        if (Request.Form["secproblem"].Equals("cusproblem"))
        {
            Question = this.cusproblem.Value;
        }
        else
        {
            Question = Request.Form["secproblem"];
        }

        string Answer = this.secanswer.Value;

        string Sex="";
        if(this.rd1.Checked)
        {
            Sex = "男";
        }
        else if(this.rd2.Checked)
        {
            Sex = "女";
        }
        string RealName =this.realname.Value;
        string Email = this.email.Value;
        string birthday=this.year.Value+"-"+this.month.Value+"-"+this.day.Value;
        DateTime Birthday = DateTime.Parse(birthday);  
        DateTime RegTime = DateTime.Now;
        string IP = Request.UserHostAddress;

        VPINews.BLL.UserInfo bll_user = new VPINews.BLL.UserInfo();
        VPINews.Model.UserInfo mod_user = new VPINews.Model.UserInfo();
        mod_user.UserName = UserName;
        mod_user.Possword = Password;
        mod_user.Question = Question;
        mod_user.Answer = Answer;
        mod_user.RealName = RealName;
        mod_user.Sex =Sex;
        mod_user.Email = Email;
        mod_user.Birthday = Birthday;
        mod_user.RegTime = RegTime;
        mod_user.IP = IP;

        bll_user.Add(mod_user);
    }
}
